home *** CD-ROM | disk | FTP | other *** search
/ Computer Shopper 125 / Computer Shopper CD-ROM Issue 125 (1998-07)(Dennis Publishing).iso / Business / Dazzler / DAZZLER.Z / CGraphicsAction.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-11-26  |  1.9 KB  |  74 lines

  1. import java.awt.Dimension;
  2. import java.awt.Graphics;
  3. import java.awt.Rectangle;
  4. import java.io.DataInputStream;
  5.  
  6. public class CGraphicsAction extends CDisplayAction {
  7.    protected CPicture m_Picture = new CPicture();
  8.    protected int m_nFlags;
  9.    private CRect m_rcOffset = new CRect();
  10.  
  11.    void DrawObject(Graphics var1, int var2, CRect var3) {
  12.       this.m_Picture.Draw(var1, var3);
  13.    }
  14.  
  15.    boolean LoadFromFile(DataInputStream var1) {
  16.       FileLoad.ReadCPlusShort(var1);
  17.       this.m_nFlags = FileLoad.ReadCPlusInt(var1);
  18.       this.m_Picture.LoadFromFile(var1);
  19.       return super.LoadFromFile(var1);
  20.    }
  21.  
  22.    public CGraphicsAction() {
  23.       super(10);
  24.    }
  25.  
  26.    boolean DoAction() {
  27.       boolean var1 = false;
  28.       new Dimension();
  29.       if (!this.m_Picture.HasImageLoaded()) {
  30.          var1 = true;
  31.       }
  32.  
  33.       Dimension var2;
  34.       if ((var2 = this.m_Picture.LoadImage()) != null) {
  35.          CRect var3 = ((CDisplayAction)this).GetActualRect();
  36.          if ((this.m_nFlags & 'ΦÇÇ') != 0) {
  37.             Globals.thePresView.CanRemoveDrawObjects(var3, (CAction)this);
  38.          }
  39.  
  40.          if ((this.m_Picture.m_nFlags & 2048) == 0) {
  41.             var3.width = Math.min(var3.width, var2.width);
  42.             var3.height = Math.min(var3.height, var2.height);
  43.          }
  44.  
  45.          if (!((Rectangle)var3).equals(((CDisplayAction)this).GetDrawRect())) {
  46.             if (!((CDisplayAction)this).GetDrawRect().isEmpty()) {
  47.                Globals.thePresView.InvalidateOffScreenRect(((CDisplayAction)this).GetDrawRect());
  48.             }
  49.  
  50.             ((CDisplayAction)this).SetDrawRect(var3);
  51.             var1 = true;
  52.          }
  53.       }
  54.  
  55.       if (this.m_rcOffset.x != this.m_Picture.m_rcSource.GetRect().x || this.m_rcOffset.y != this.m_Picture.m_rcSource.GetRect().y) {
  56.          this.m_rcOffset.reshape(this.m_Picture.m_rcSource.GetRect());
  57.          var1 = true;
  58.       }
  59.  
  60.       if (super.m_Effect.HasValidEffect()) {
  61.          if ((this.m_nFlags & 'ΦÇÇ') != 0) {
  62.             Globals.thePresView.AddDrawObject((CIconObject)this, 6144, var1);
  63.          } else {
  64.             Globals.thePresView.RenderAndDrawDirtyList();
  65.             Globals.thePresView.AddDrawObject((CIconObject)this, 2048, var1);
  66.          }
  67.       } else {
  68.          Globals.thePresView.AddDrawObject((CIconObject)this, 0, var1);
  69.       }
  70.  
  71.       return true;
  72.    }
  73. }
  74.